// 输入框组件实例

import { assignInWith } from 'lodash'
import type { dateRangeConfigType, inputConfigType, radioGroupConfigType } from '../../../../../types/index'
import BaseEntity from '../../BaseEntity'
import { uid } from 'uid'
import type { configType, slotFormConfigType } from '../../BaseEntity'
import { entityType } from '../..'
export default class CheckboxGroupEntity extends BaseEntity {
    

    constructor(config: configType, slotFormConfig: slotFormConfigType) {
        let baseConfig: configType = {
            class: ['draggable-form-hover'],
            style: { width: '100%' },
            field: 'Checkbox_Group_' + uid(4),
            label: '多选框组',
            hideLabel: false,
            required: false,
        }
        let baseSlotFormConfig = {
            modelValue: "option1",
            options:[{
                label:"选项1",
                value:"option1"
            },{
                label:"选项2",
                value:"option2"
            }],
          
        }
        let componentConfig: radioGroupConfigType = {
            options:{
               type:'optionsSetting',
                formItemConfig: {
                    label: '单选框选项'
                },
                formItemElement: {
                    modelValue: [],
                }
            }
           
        }

        super(
          entityType.checkboxGroup,
            assignInWith(baseConfig, config),
            assignInWith(baseSlotFormConfig, slotFormConfig),
            componentConfig
        )
        this.initSlotFormConfig()
    }
    initSlotFormConfig(){
      //初始化表单组件可配置项 因为表单组件可配置项是根据表单组件所拥有得属性来定义的 配置项得值需要对应初始化实例得对应属性得值

      this.componentConfig.options.formItemElement.modelValue= this.slotFormConfig["options"]
    }
}
